#pragma once

namespace Vortex { namespace Wrapper { namespace Direct3D {

	public enum struct D3DDeviceType {
		Hal           = 1,
		NullRef       = 4,
		Ref           = 2,
		Sw            = 3
	};

	public enum struct ShaderType {
		VertexShader,
		PixelShader
	};

	public enum struct ShaderIncludeType {
		Local = 0,
		System = 1
	};

	public enum struct D3DDeviceCreateFlags {
		HardwareVertexprocessing = D3DCREATE_HARDWARE_VERTEXPROCESSING,
		SoftwareVertexprocessing = D3DCREATE_SOFTWARE_VERTEXPROCESSING,
		PureDevice = D3DCREATE_PUREDEVICE,
		MixedVertexprocessing = D3DCREATE_MIXED_VERTEXPROCESSING
	};

	public enum struct D3DFormat {
		Unknown              =  0,

		R8G8B8               = 20,
		A8R8G8B8             = 21,
		X8R8G8B8             = 22,
		R5G6B5               = 23,
		X1R5G5B5             = 24,
		A1R5G5B5             = 25,
		A4R4G4B4             = 26,
		R3G3B2               = 27,
		A8                   = 28,
		A8R3G3B2             = 29,
		X4R4G4B4             = 30,
		A2B10G10R10          = 31,
		A8B8G8R8             = 32,
		X8B8G8R8             = 33,
		G16R16               = 34,
		A2R10G10B10          = 35,
		A16B16G16R16         = 36,

		A8P8                 = 40,
		P8                   = 41,

		L8                   = 50,
		A8L8                 = 51,
		A4L4                 = 52,

		V8U8                 = 60,
		L6V5U5               = 61,
		X8L8V8U8             = 62,
		Q8W8V8U8             = 63,
		V16U16               = 64,
		A2W10V10U10          = 67,

		UYVY                 = MAKEFOURCC('U', 'Y', 'V', 'Y'),
		R8G8_B8G8            = MAKEFOURCC('R', 'G', 'B', 'G'),
		YUY2                 = MAKEFOURCC('Y', 'U', 'Y', '2'),
		G8R8_G8B8            = MAKEFOURCC('G', 'R', 'G', 'B'),
		DXT1                 = MAKEFOURCC('D', 'X', 'T', '1'),
		DXT2                 = MAKEFOURCC('D', 'X', 'T', '2'),
		DXT3                 = MAKEFOURCC('D', 'X', 'T', '3'),
		DXT4                 = MAKEFOURCC('D', 'X', 'T', '4'),
		DXT5                 = MAKEFOURCC('D', 'X', 'T', '5'),

		D16_LOCKABLE         = 70,
		D32                  = 71,
		D15S1                = 73,
		D24S8                = 75,
		D24X8                = 77,
		D24X4S4              = 79,
		D16                  = 80,

		D32F_LOCKABLE        = 82,
		D24FS8               = 83,


		L16                  = 81,

		VERTEXDATA           =100,
		INDEX16              =101,
		INDEX32              =102,

		Q16W16V16U16         =110,

		MULTI2_ARGB8         = MAKEFOURCC('M','E','T','1'),

		// Floating point surface formats

		// s10e5 formats (16-bits per channel)
		R16F                 = 111,
		G16R16F              = 112,
		A16B16G16R16F        = 113,

		// IEEE s23e8 formats (32-bits per channel)
		R32F                 = 114,
		G32R32F              = 115,
		A32B32G32R32F        = 116,

		CxV8U8               = 117
	};

	public enum struct D3DPresentInterval {
		Immediate = D3DPRESENT_INTERVAL_IMMEDIATE,
		One = D3DPRESENT_INTERVAL_ONE
	};

	public enum struct D3DSwapEffect {
		Discard = D3DSWAPEFFECT_DISCARD,
		Flip = D3DSWAPEFFECT_FLIP,
		Copy = D3DSWAPEFFECT_COPY
	};

	public enum struct D3DMultisampleType {
		None = D3DMULTISAMPLE_NONE,
		NonMaskable = D3DMULTISAMPLE_NONMASKABLE,
		x2 = D3DMULTISAMPLE_2_SAMPLES,
		x3 = D3DMULTISAMPLE_3_SAMPLES,
		x4 = D3DMULTISAMPLE_4_SAMPLES,
		x5 = D3DMULTISAMPLE_5_SAMPLES,
		x6 = D3DMULTISAMPLE_6_SAMPLES,
		x7 = D3DMULTISAMPLE_7_SAMPLES,
		x8 = D3DMULTISAMPLE_8_SAMPLES,
		x9 = D3DMULTISAMPLE_9_SAMPLES,
		x10 = D3DMULTISAMPLE_10_SAMPLES,
		x11 = D3DMULTISAMPLE_11_SAMPLES,
		x12 = D3DMULTISAMPLE_12_SAMPLES,
		x13 = D3DMULTISAMPLE_13_SAMPLES,
		x14 = D3DMULTISAMPLE_14_SAMPLES,
		x15 = D3DMULTISAMPLE_15_SAMPLES,
		x16 = D3DMULTISAMPLE_16_SAMPLES
	};

	///<summary>Device Clear() method targets</summary>
	[Flags]
	public enum struct D3DClearFlags {
		Stencil = D3DCLEAR_STENCIL,
		Target = D3DCLEAR_TARGET,
		ZBuffer = D3DCLEAR_ZBUFFER
	};

	public enum struct D3DResourceType {
		Surface = D3DRTYPE_SURFACE,
		Volume = D3DRTYPE_VOLUME,
		Texture = D3DRTYPE_TEXTURE,
		VolumeTexture = D3DRTYPE_VOLUMETEXTURE,
		CubeTexture = D3DRTYPE_CUBETEXTURE,
		VertexBuffer = D3DRTYPE_VERTEXBUFFER,
		IndexBuffer = D3DRTYPE_INDEXBUFFER
	};

	[Flags]
	public enum struct D3DUsage {
		None = 0,
		RenderTarget = D3DUSAGE_RENDERTARGET,
		Dynamic = D3DUSAGE_DYNAMIC,
		DepthStencil = D3DUSAGE_DEPTHSTENCIL,
		AutoGenMipMap = D3DUSAGE_AUTOGENMIPMAP,
		DMap = D3DUSAGE_DMAP,
		WriteOnly = D3DUSAGE_WRITEONLY,
		SoftwareProcessing = D3DUSAGE_SOFTWAREPROCESSING,
		DoNotClip = D3DUSAGE_DONOTCLIP,
		Points = D3DUSAGE_POINTS
	};

	public enum struct D3DPool {
		Default = D3DPOOL_DEFAULT,
		Managed = D3DPOOL_MANAGED,
		SystemMemory = D3DPOOL_SYSTEMMEM,
		Scratch = D3DPOOL_SCRATCH
	};

	[Flags]
	public enum struct D3DLockFlags {
		None = 0,
		Disacrd = D3DLOCK_DISCARD,
		NoDirtyUpdate = D3DLOCK_NO_DIRTY_UPDATE,
		NoSysLock = D3DLOCK_NOSYSLOCK,
		ReadOnly = D3DLOCK_READONLY,
		NoOverrite = D3DLOCK_NOOVERWRITE
	};

	[Flags]
	public enum struct D3DFVF {
		None = 0,
		Reserved0 = D3DFVF_RESERVED0 ,       
		PositionMask = D3DFVF_POSITION_MASK,    	
		XYZ = D3DFVF_XYZ,              
		XYZRHW = D3DFVF_XYZRHW,           
		XYZB1 = D3DFVF_XYZB1,            
		XYZB2 = D3DFVF_XYZB2,            
		XYZB3 = D3DFVF_XYZB3,            
		XYZB4 = D3DFVF_XYZB4,            
		XYZB5 = D3DFVF_XYZB5,            
		XYZW = D3DFVF_XYZW,             

		Normal = D3DFVF_NORMAL,           
		PSize = D3DFVF_PSIZE,           
		Diffuse = D3DFVF_DIFFUSE,          
		Specular = D3DFVF_SPECULAR,         

		TexCountMask = D3DFVF_TEXCOUNT_MASK,    
		TexCountShift = D3DFVF_TEXCOUNT_SHIFT,   
		Tex0 = D3DFVF_TEX0,             
		Tex1 = D3DFVF_TEX1,             
		Tex2 = D3DFVF_TEX2,             
		Tex3 = D3DFVF_TEX3,             
		Tex4 = D3DFVF_TEX4,             
		Tex5 = D3DFVF_TEX5,             
		Tex6 = D3DFVF_TEX6,             
		Tex7 = D3DFVF_TEX7,             
		Tex8 = D3DFVF_TEX8,             

		LastBetaUBYTE4 = D3DFVF_LASTBETA_UBYTE4,
		LastBetaD3DCOLOR = D3DFVF_LASTBETA_D3DCOLOR,

		Reserved2 = D3DFVF_RESERVED2
	};

	///<summary>Enumeration of device render states</summary>
	public enum struct D3DRenderState {
		ZENABLE                   = 7,    /* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) */
		FILLMODE                  = 8,    /* D3DFILLMODE */
		SHADEMODE                 = 9,    /* D3DSHADEMODE */
		ZWRITEENABLE              = 14,   /* TRUE to enable z writes */
		ALPHATESTENABLE           = 15,   /* TRUE to enable alpha tests */
		LASTPIXEL                 = 16,   /* TRUE for last-pixel on lines */
		SRCBLEND                  = 19,   /* D3DBLEND */
		DESTBLEND                 = 20,   /* D3DBLEND */
		CULLMODE                  = 22,   /* D3DCULL */
		ZFUNC                     = 23,   /* D3DCMPFUNC */
		ALPHAREF                  = 24,   /* D3DFIXED */
		ALPHAFUNC                 = 25,   /* D3DCMPFUNC */
		DITHERENABLE              = 26,   /* TRUE to enable dithering */
		ALPHABLENDENABLE          = 27,   /* TRUE to enable alpha blending */
		FOGENABLE                 = 28,   /* TRUE to enable fog blending */
		SPECULARENABLE            = 29,   /* TRUE to enable specular */
		FOGCOLOR                  = 34,   /* D3DCOLOR */
		FOGTABLEMODE              = 35,   /* D3DFOGMODE */
		FOGSTART                  = 36,   /* Fog start (for both vertex and pixel fog) */
		FOGEND                    = 37,   /* Fog end      */
		FOGDENSITY                = 38,   /* Fog density  */
		RANGEFOGENABLE            = 48,   /* Enables range-based fog */
		STENCILENABLE             = 52,   /* BOOL enable/disable stenciling */
		STENCILFAIL               = 53,   /* D3DSTENCILOP to do if stencil test fails */
		STENCILZFAIL              = 54,   /* D3DSTENCILOP to do if stencil test passes and Z test fails */
		STENCILPASS               = 55,   /* D3DSTENCILOP to do if both stencil and Z tests pass */
		STENCILFUNC               = 56,   /* D3DCMPFUNC fn.  Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true */
		STENCILREF                = 57,   /* Reference value used in stencil test */
		STENCILMASK               = 58,   /* Mask value used in stencil test */
		STENCILWRITEMASK          = 59,   /* Write mask applied to values written to stencil buffer */
		TEXTUREFACTOR             = 60,   /* D3DCOLOR used for multi-texture blend */
		WRAP0                     = 128,  /* wrap for 1st texture coord. set */
		WRAP1                     = 129,  /* wrap for 2nd texture coord. set */
		WRAP2                     = 130,  /* wrap for 3rd texture coord. set */
		WRAP3                     = 131,  /* wrap for 4th texture coord. set */
		WRAP4                     = 132,  /* wrap for 5th texture coord. set */
		WRAP5                     = 133,  /* wrap for 6th texture coord. set */
		WRAP6                     = 134,  /* wrap for 7th texture coord. set */
		WRAP7                     = 135,  /* wrap for 8th texture coord. set */
		CLIPPING                  = 136,
		LIGHTING                  = 137,
		AMBIENT                   = 139,
		FOGVERTEXMODE             = 140,
		COLORVERTEX               = 141,
		LOCALVIEWER               = 142,
		NORMALIZENORMALS          = 143,
		DIFFUSEMATERIALSOURCE     = 145,
		SPECULARMATERIALSOURCE    = 146,
		AMBIENTMATERIALSOURCE     = 147,
		EMISSIVEMATERIALSOURCE    = 148,
		VERTEXBLEND               = 151,
		CLIPPLANEENABLE           = 152,
		POINTSIZE                 = 154,   /* float point size */
		POINTSIZE_MIN             = 155,   /* float point size min threshold */
		POINTSPRITEENABLE         = 156,   /* BOOL point texture coord control */
		POINTSCALEENABLE          = 157,   /* BOOL point size scale enable */
		POINTSCALE_A              = 158,   /* float point attenuation A value */
		POINTSCALE_B              = 159,   /* float point attenuation B value */
		POINTSCALE_C              = 160,   /* float point attenuation C value */
		MULTISAMPLEANTIALIAS      = 161,  // BOOL - set to do FSAA with multisample buffer
		MULTISAMPLEMASK           = 162,  // DWORD - per-sample enable/disable
		PATCHEDGESTYLE            = 163,  // Sets whether patch edges will use float style tessellation
		DEBUGMONITORTOKEN         = 165,  // DEBUG ONLY - token to debug monitor
		POINTSIZE_MAX             = 166,   /* float point size max threshold */
		INDEXEDVERTEXBLENDENABLE  = 167,
		COLORWRITEENABLE          = 168,  // per-channel write enable
		TWEENFACTOR               = 170,   // float tween factor
		BLENDOP                   = 171,   // D3DBLENDOP setting
		POSITIONDEGREE            = 172,   // NPatch position interpolation degree. D3DDEGREE_LINEAR or D3DDEGREE_CUBIC (default)
		NORMALDEGREE              = 173,   // NPatch normal interpolation degree. D3DDEGREE_LINEAR (default) or D3DDEGREE_QUADRATIC
		SCISSORTESTENABLE         = 174,
		SLOPESCALEDEPTHBIAS       = 175,
		ANTIALIASEDLINEENABLE     = 176,
		MINTESSELLATIONLEVEL      = 178,
		MAXTESSELLATIONLEVEL      = 179,
		ADAPTIVETESS_X            = 180,
		ADAPTIVETESS_Y            = 181,
		ADAPTIVETESS_Z            = 182,
		ADAPTIVETESS_W            = 183,
		ENABLEADAPTIVETESSELLATION = 184,
		TWOSIDEDSTENCILMODE       = 185,   /* BOOL enable/disable 2 sided stenciling */
		CCW_STENCILFAIL           = 186,   /* D3DSTENCILOP to do if ccw stencil test fails */
		CCW_STENCILZFAIL          = 187,   /* D3DSTENCILOP to do if ccw stencil test passes and Z test fails */
		CCW_STENCILPASS           = 188,   /* D3DSTENCILOP to do if both ccw stencil and Z tests pass */
		CCW_STENCILFUNC           = 189,   /* D3DCMPFUNC fn.  ccw Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true */
		COLORWRITEENABLE1         = 190,   /* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS */
		COLORWRITEENABLE2         = 191,   /* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS */
		COLORWRITEENABLE3         = 192,   /* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS */
		BLENDFACTOR               = 193,   /* D3DCOLOR used for a constant blend factor during alpha blending for devices that support D3DPBLENDCAPS_BLENDFACTOR */
		SRGBWRITEENABLE           = 194,   /* Enable rendertarget writes to be DE-linearized to SRGB (for formats that expose D3DUSAGE_QUERY_SRGBWRITE) */
		DEPTHBIAS                 = 195,
		WRAP8                     = 198,   /* Additional wrap states for vs_3_0+ attributes with D3DDECLUSAGE_TEXCOORD */
		WRAP9                     = 199,
		WRAP10                    = 200,
		WRAP11                    = 201,
		WRAP12                    = 202,
		WRAP13                    = 203,
		WRAP14                    = 204,
		WRAP15                    = 205,
		SEPARATEALPHABLENDENABLE  = 206,  /* TRUE to enable a separate blending function for the alpha channel */
		SRCBLENDALPHA             = 207,  /* SRC blend factor for the alpha channel when SEPARATEDESTALPHAENABLE is TRUE */
		DESTBLENDALPHA            = 208,  /* DST blend factor for the alpha channel when SEPARATEDESTALPHAENABLE is TRUE */
		BLENDOPALPHA              = 209,  /* Blending operation for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE */
	};

	///<summary>Enumeration of device sampler states</summary>
	public enum struct D3DSamplerState {
		ADDRESSU       = 1,  /* D3DTEXTUREADDRESS for U coordinate */
		ADDRESSV       = 2,  /* D3DTEXTUREADDRESS for V coordinate */
		ADDRESSW       = 3,  /* D3DTEXTUREADDRESS for W coordinate */
		BORDERCOLOR    = 4,  /* D3DCOLOR */
		MAGFILTER      = 5,  /* D3DTEXTUREFILTER filter to use for magnification */
		MINFILTER      = 6,  /* D3DTEXTUREFILTER filter to use for minification */
		MIPFILTER      = 7,  /* D3DTEXTUREFILTER filter to use between mipmaps during minification */
		MIPMAPLODBIAS  = 8,  /* float Mipmap LOD bias */
		MAXMIPLEVEL    = 9,  /* DWORD 0..(n-1) LOD index of largest map to use (0 == largest) */
		MAXANISOTROPY  = 10, /* DWORD maximum anisotropy */
		SRGBTEXTURE    = 11, /* Default = 0 (which means Gamma 1.0,
									   no correction required.) else correct for
									   Gamma = 2.2 */
		ELEMENTINDEX   = 12, /* When multi-element texture is assigned to sampler, this
										indicates which element index to use.  Default = 0.  */
		DMAPOFFSET     = 13, /* Offset in vertices in the pre-sampled displacement map.
										Only valid for D3DDMAPSAMPLER sampler  */
	};

	public enum struct D3DPrimitiveType {
		PointList = D3DPT_POINTLIST,
		LineList = D3DPT_LINELIST,
		LineStrip = D3DPT_LINESTRIP,
		TriangleList = D3DPT_TRIANGLELIST,
		TriangleStrip = D3DPT_TRIANGLESTRIP,
		TriangleFan = D3DPT_TRIANGLEFAN
	};

	[Flags]
	public enum struct D3DXImageFilter {
		Default = -1,
		None = D3DX_FILTER_NONE,
		Point = D3DX_FILTER_POINT,
		Linear = D3DX_FILTER_LINEAR,
		Triangle = D3DX_FILTER_TRIANGLE,
		Box = D3DX_FILTER_BOX,

		MirrorU = D3DX_FILTER_MIRROR_U,
		MirrorV = D3DX_FILTER_MIRROR_V,
		MirrorW = D3DX_FILTER_MIRROR_W,
		Mirror = D3DX_FILTER_MIRROR,

		Dither = D3DX_FILTER_DITHER
	};

	///<summary>List of supported image file formats</summary>
	public enum struct D3DXImageFileFormat {
		Bmp = D3DXIFF_BMP,
		Jpg = D3DXIFF_JPG,
		Tga = D3DXIFF_TGA,
		Png = D3DXIFF_PNG,
		Dds = D3DXIFF_DDS,
		Ppm = D3DXIFF_PPM,
		Dib = D3DXIFF_DIB,
		Hdr = D3DXIFF_HDR,
		Pfm = D3DXIFF_PFM,
	};

	[Flags]
	public enum struct D3DXCompileShaderFlags {
		None = 0,
		PackMatrix_ColumnMajor = D3DXSHADER_PACKMATRIX_COLUMNMAJOR,
		PackMatrix_RowMajor = D3DXSHADER_PACKMATRIX_ROWMAJOR,
		Debug = D3DXSHADER_DEBUG,
		SlipOptimization = D3DXSHADER_SKIPOPTIMIZATION,
		SkipValidation = D3DXSHADER_SKIPVALIDATION
	};

	public enum struct D3DDeclType : BYTE {
		Float1      = 0,
		Float2      = 1,
		Float3      = 2,
		Float4      = 3,
		Color		= 4,
		UByte4      = 5,
		Short2      = 6,
		Short4      = 7,
		UByte4N     = 8,
		Short2N     = 9,
		Short4N     = 10,
		UShort2N    = 11,
		UShort4N    = 12,
		UDec3       = 13,
		Dec3N       = 14,
		Float16_2   = 15,
		Float16_4   = 16,
		Unused		= 17
	};

	public enum struct D3DDeclMethod : BYTE {
		Default            = 0,
		PartialU           = 1,
		PartialV           = 2,
		CrossUV            = 3,
		UV                 = 4,
		LookUp             = 5,
		LookUpPresampled   = 6 
	};

	public enum struct D3DDeclUsage : BYTE {
		Position       = 0,
		BlendWeight    = 1,
		BlendIndices   = 2,
		Normal         = 3,
		PSize          = 4,
		TextCoord      = 5,
		Tangent        = 6,
		Binormal       = 7,
		TessFactor     = 8,
		PositionT      = 9,
		Color          = 10,
		Fog            = 11,
		Depth          = 12,
		Sampler        = 13 
	};

	[Flags]
	public enum struct D3DLock {
		Discard = D3DLOCK_DISCARD,
		DoNotWait = D3DLOCK_DONOTWAIT,
		NoDirtyUpdate = D3DLOCK_NO_DIRTY_UPDATE,
		NoSysLock = D3DLOCK_NOSYSLOCK,
		ReadOnly = D3DLOCK_READONLY		
	};

} } }